

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;
using InfraStructureLayer;

namespace DataLayer
{
	public class datPhotoAlbums
	{
		public datPhotoAlbums()
		{
		}
		
		#region  Code Factory Generated Methods
		public void DeletePhotoAlbumsByPhotoAlbumId(entPhotoAlbums parEntPhotoAlbums, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pPhotoAlbumId",parEntPhotoAlbums.PhotoAlbumId);
			parDbConnector.ExecuteNonQuery("DeletePhotoAlbumsByPhotoAlbumId",insDbParamCollection);
		}
		public void InsertPhotoAlbums(entPhotoAlbums parEntPhotoAlbums, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pPublishDate",parEntPhotoAlbums.PublishDate);
			insDbParamCollection.Add("@pPhotoAlbumDescription",parEntPhotoAlbums.PhotoAlbumDescription);
			insDbParamCollection.AddOutput("@pPhotoAlbumId",DbType.Int32);
			parDbConnector.ExecuteNonQuery("InsertPhotoAlbums",insDbParamCollection);
			parEntPhotoAlbums.PhotoAlbumId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
		}
		public void UpdatePhotoAlbumsByPhotoAlbumId(entPhotoAlbums parEntPhotoAlbums, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pPhotoAlbumId",parEntPhotoAlbums.PhotoAlbumId);
			
			insDbParamCollection.Add("@pPublishDate",parEntPhotoAlbums.PublishDate);
			insDbParamCollection.Add("@pPhotoAlbumDescription",parEntPhotoAlbums.PhotoAlbumDescription);
			parDbConnector.ExecuteNonQuery("UpdatePhotoAlbumsByPhotoAlbumId",insDbParamCollection);
		}
		public DataTable SelectPhotoAlbums(DbConnector parDbConnector)
		{
			
			return parDbConnector.ExecuteDataTable("SelectPhotoAlbums",null);
		}
		public void SelectPhotoAlbumsByPhotoAlbumId(entPhotoAlbums parEntPhotoAlbums, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pPhotoAlbumId",parEntPhotoAlbums.PhotoAlbumId);
			DataTable insDataTable = new DataTable();
			insDataTable = parDbConnector.ExecuteDataTable("SelectPhotoAlbumsByPhotoAlbumId",insDbParamCollection);
			if (insDataTable.Rows.Count>0)
			{
				if (insDataTable.Rows[0]["PhotoAlbumId"]!=DBNull.Value)
				{
					parEntPhotoAlbums.PhotoAlbumId = Convert.ToInt32(insDataTable.Rows[0]["PhotoAlbumId"]);
				}
				if (insDataTable.Rows[0]["PublishDate"]!=DBNull.Value)
				{
					parEntPhotoAlbums.PublishDate = Convert.ToDateTime(insDataTable.Rows[0]["PublishDate"]);
				}
				if (insDataTable.Rows[0]["PhotoAlbumDescription"]!=DBNull.Value)
				{
					parEntPhotoAlbums.PhotoAlbumDescription = insDataTable.Rows[0]["PhotoAlbumDescription"].ToString();
				}
			}
		}
	
		#endregion
        public DataTable SelectPhotoAlbumsByLanguageId(DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pLanguageId", CurrentContext.LanguageId);
            return parDbConnector.ExecuteDataTable("SelectPhotoAlbumsByLanguageId", insDbParamCollection);
        }
        
	}
}